﻿
@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>合同会审</title>
    <link href="~/Layui/layui-v2.2.3/layui/css/layui.css" rel="stylesheet" />
    <link href="~/Layui/layui-v2.2.3/layui/css/modules/layer/default/layer.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-1.10.2.js"></script>
    <script src="~/Layui/layui-v2.2.3/layui/layui.js"></script>
    <script src="~/Layui/layui-v2.2.3/layui/lay/modules/layer.js"></script>
    <script src="~/Layui/layui-v2.2.3/layui/lay/modules/form.js"></script>
    <script src="~/Layui/layui-v2.2.3/layui/lay/modules/laydate.js"></script>
    <script src="~/Layui/layui-v2.2.3/layui/lay/modules/element.js"></script>
    <script src="~/assets/data.js"></script>
    <script src="~/assets/province.js"></script>
    <style>
        #bottomdiv {
            text-align: center;
            width: 100%;
            height: 50px;
            line-height: 60px;
            background-color: #b5c9e3;
            position: absolute;
            bottom: 0px;
        }

        * {
            margin: 0;
            padding: 0;
        }
    </style>
    <script type="text/javascript">
  //省市县的三级联动
        var defaults = {
            s1: 'CAOprovince',
            s2: 'CAOCity',
            s3: 'CAOcounty',
            v1: null,
            v2: null,
            v3: null
        };

    </script>
</head>
<body>
    <div style="width:100%;height:50px; background-color:#f5f7f8;text-align:center;margin:0 auto;line-height:25px; border-bottom:2px solid #e3e5e6">
        <h3>合同会审—发起人</h3>
        <span style="color:#b5c9e3">流程类别：市场管理</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#b5c9e3">流程简介：合同会审</span>
    </div>
    <form class="layui-form" action="/Sprintfuyu/Sell/OrderMangement" method="post">
        <div style="width:100%;max-height:460px; margin :0 auto;overflow-y:scroll;  border:1px solid #e3e5e6">
            <h4 style="padding-left:10%">流程基本信息</h4>
            <div style="width:80%;height:20px; text-align: center;margin:0 auto;">
                <div style="width:100%;background-color:#f8f8f8;text-align:center"><h5>合同会审</h5></div>
            </div>
            <table class="layui-table" style="width:80%;margin:0 auto">
                <tr>
                    <td>
                        <div class="layui-form-item">
                            <label class="layui-form-label">客户名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="CAOClientName" placeholder="必填" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </td>
                    <td>
                        <div class="layui-form-item">
                            <label class="layui-form-label">合同编号</label>
                            <div class="layui-input-block">
                                <input type="text" name="ID" placeholder="请输入" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <div class="layui-form-item">
                            <label class="layui-form-label">选择地区</label>
                            <div class="layui-input-inline">
                                <select name="CAOprovince" id="CAOprovince" lay-filter="CAOprovince">
                                    <option value="">请选择省</option>
                                </select>
                            </div>
                            <div class="layui-input-inline">
                                <select name="CAOCity" id="CAOCity" lay-filter="CAOCity">
                                    <option value="">请选择市</option>
                                </select>
                            </div>
                            <div class="layui-input-inline">
                                <select name="CAOcounty" id="CAOcounty" lay-filter="CAOcounty">
                                    <option value="">请选择县/区</option>
                                </select>
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="layui-form-item">
                            <label class="layui-form-label">项目名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="CAOItemName" placeholder="请输入" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </td>
                    <td>
                        <div class="layui-form-item">
                            <label class="layui-form-label">分类</label>
                            <div class="layui-input-block">
                                <select name="CAOType">
                                    <option value="业务合作">业务合作</option>
                                    <option value="代理分销">代理分销</option>
                                    <option value="产品销售">产品销售</option>
                                    <option value="服务">服务</option>
                                    <option value="其他">其他</option>
                                </select>
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="layui-form-item">
                            <label class="layui-form-label">状态</label>
                            <div class="layui-input-block">
                                <input name="CAOStatu" value="执行中" title="执行中" checked="" type="radio">
                                <input name="CAOStatu" value="结束" title="结束" type="radio">
                                <input name="CAOStatu" value="意外终止" title="意外终止" type="radio">
                            </div>
                        </div>

                    </td>
                    <td>
                        <div class="layui-form-item">
                            <label class="layui-form-label">付款方式</label>
                            <div class="layui-input-block">
                                <select name="CAOpaymentType">
                                    <option value="支票">支票</option>
                                    <option value="现金">现金</option>
                                    <option value="邮政汇款">邮政汇款</option>
                                    <option value="电汇">电汇</option>
                                    <option value="网上银行">网上银行</option>
                                    <option value="其他方式">其他方式</option>
                                </select>
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="layui-form-item">
                            <label class="layui-form-label">开始日期</label>
                            <div class="layui-input-block">
                                <input id="CAOstartTime" type="text" name="CAOstartTime" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input" lay-verify="data">
                            </div>
                        </div>
                    </td>
                    <td>
                        <div class="layui-form-item">
                            <label class="layui-form-label">结束日期</label>
                            <div class="layui-input-block">
                                <input id="CAOendTime" type="text" name="CAOendTime" placeholder="请输入" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="layui-form-item">
                            <label class="layui-form-label">总金额</label>
                            <div class="layui-input-inline">
                                <input type="text" id="CAOsumMoney" name="CAOsumMoney" placeholder="最大999999999999" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">元</div>
                        </div>
                    </td>
                    <td>
                        <div class="layui-form-item">
                            <label class="layui-form-label">金额大写</label>
                            <div class="layui-input-block">
                                <input type="text" id="CAOSumMoneyBig" name="CAOSumMoneyBig" required placeholder="必填" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="layui-form-item">
                            <label class="layui-form-label">客户签约人</label>
                            <div class="layui-input-block">
                                <input type="text" name="CAOClent" placeholder="请输入" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </td>
                    <td>
                        <div class="layui-form-item">
                            <label class="layui-form-label">我方签约人</label>
                            <div class="layui-input-block">
                                <input type="text" name="CAOMainName" placeholder="请输入" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="layui-form-item">
                            <label class="layui-form-label">支付地点</label>
                            <div class="layui-input-block">
                                <input type="text" name="CAOAddress" placeholder="请输入" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </td>
                    <td>
                        <div class="layui-form-item">
                            <label class="layui-form-label">签约日期</label>
                            <div class="layui-input-block">
                                <input type="text" id="CAOcreateTime" name="CAOcreateTime" placeholder="请输入" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <div class="layui-form-item">
                            <label class="layui-form-label">合同主要条款</label>
                            <div class="layui-input-block">
                                <textarea name="CAOMainclause" placeholder="请输入内容" class="layui-textarea"></textarea>
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <div class="layui-form-item">
                            <label class="layui-form-label">备注</label>
                            <div class="layui-input-block">
                                <textarea name="CAOremark" placeholder="请输入内容" class="layui-textarea"></textarea>
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <div style="width:100%;height:20px;background-color:#b5c9e3;text-align:center;line-height:20px">回款计划</div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <table class="layui-table">
                            <tr style="text-align:center">
                                <td>序号</td>
                                <td>期次</td>
                                <td>计划回款日期</td>
                                <td>金额</td>
                                <td>备注</td>
                            </tr>
                            <tbody id="tb1">
                                <tr>
                                    <td>
                                        <input type="button" class="layui-btn layui-btn-primary layui-btn-sm layui-icon" value="&#xe619;" onclick="AddRow(this)" />

                                        <input type="button" class="layui-btn layui-btn-primary layui-btn-sm layui-icon" value="&#xe61a;" onclick="DeleteRow(this)" />

                                    </td>
                                    <td>
                                        <select name="city">
                                            <option value="1">1</option>
                                            <option value="2">2</option>
                                            <option value="3">3</option>
                                            <option value="4">4</option>
                                            <option value="5">5</option>
                                            <option value="6">6</option>
                                            <option value="7">7</option>
                                            <option value="8">8</option>
                                            <option value="9">9</option>
                                            <option value="10">10</option>
                                            <option value="11">11</option>
                                            <option value="12">12</option>
                                        </select>
                                    </td>
                                    <td>

                                        <input id="data" type="text" name="data" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">

                                    </td>
                                    <td>
                                        <input type="text" name="" placeholder="请输入" autocomplete="off" class="layui-input">
                                    </td>
                                    <td>

                                        <input type="text" name="" placeholder="请输入" autocomplete="off" class="layui-input">
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
            </table>
            <div style="width:80%;height:auto;margin:0 auto;margin-top:10px">
                <h2>流程处理中心</h2>
                <div class="layui-collapse" lay-accordion>
                    <div class="layui-colla-item">
                        <h2 class="layui-colla-title"><i class="layui-icon">&#x1002;</i>处理意见</h2>
                        <div class="layui-colla-content">内容区域</div>
                    </div>
                    <div class="layui-colla-item">
                        <h2 class="layui-colla-title"><i class="layui-icon">&#xe64d;</i>流程附件</h2>
                        <div class="layui-colla-content">内容区域</div>
                    </div>
                    <div class="layui-colla-item">
                        <h2 class="layui-colla-title"><i class="layui-icon">&#xe62a;</i>流程日志</h2>
                        <div class="layui-colla-content">内容区域</div>
                    </div>
                </div>
            </div>
        </div>
        <div id="bottomdiv">
            <input id="Submit1" type="submit" value="提交" class="layui-btn" /><input id="cancel" type="button" value="取消" class="layui-btn layui-btn-primary" />
        </div>
    </form>
    @Html.Raw(@ViewBag.alert);
    <script type="text/javascript">

    

        var i = 1;
        //注意：parent 是 JS 自带的全局对象，可用于操作父页面
        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引


        layui.use(['layer', 'element', 'laydate'], function () {
            var laydate = layui.laydate;
            var element = layui.element;
            var layer = layui.layer;

            //结束日期
            laydate.render({
                elem: '#CAOendTime'
            });
            //开始日期
            laydate.render({
                elem: '#CAOstartTime'
            })
            //签约日期
            laydate.render({
                elem: '#CAOcreateTime'
            })
            //计划回款日期
            laydate.render({
                elem: '#data'
            })
        })
        //添加回款计划
        function AddRow(obj) {

            $("#tb1").append($(obj).parent().parent().parent().html());

        }
        //删除回款计划
        function DeleteRow(obj) {
            $(obj).parent().parent().remove();
        }
        //将金额转为大写
        $("#CAOsumMoney").blur(function () {
            var price = $("#CAOsumMoney").val();
            var bigprice = toUpcase(price);
            $("#CAOSumMoneyBig").val(bigprice);

        })
        function toUpcase(price) {
            var num = convertFloat(price)
            var strOutput = "";
            var strUnit = "仟佰拾亿仟佰拾万仟佰拾元角分";
            num += "00";
            var intPos = num.indexOf(".");
            if (intPos >= 0) {
                num = num.substring(0, intPos) + num.substr(intPos + 1, 2);
            }
            strUnit = strUnit.substr(strUnit.length - num.length);
            for (var i = 0; i < num.length; i++) {
                strOutput += "零壹贰叁肆伍陆柒捌玖".substr(num.substr(i, 1), 1) + strUnit.substr(i, 1);
            }
            return strOutput.replace(/零角零分$/, "整").replace(/零[仟佰拾]/g, "零").replace(/零{2,}/g, "零").replace(/零([亿|万])/g, "$1")
                    .replace(/零+元/, "元").replace(/亿零{0,3}万/, "亿").replace(/^元/, "零元");
        };

        // ---------------------------------
        // 转换浮点数
        // ---------------------------------
        function convertFloat(value) {
            if (!value)
                return 0;
            var result = value.toString();
            result = result.replace(new RegExp("\,", "gm"), "");
            var result = parseFloat(result);
            if (isNaN(result))
                result = 0;

            return result;
        }
        $("#cancel").click(function () {
            parent.layer.close(index);
        })
    </script>
</body>
</html>
